package com.tang.jvm.init;

/**
 * @author Tang
 * @classname Init
 * @description [ 初始化 ]
 * @date 2021/5/25 21:56
 */
public class InitiativeInit {

    static {
        System.out.println("InitiativeInit static...");
    }

    public InitiativeInit() {
        System.out.println("InitiativeInit constructor...");
    }

    public static void main(String[] args) {

        InitiativeInit initiativeInit = new InitiativeInit();
        new A();
        /**
         * JVM的初始化是懒加载的，真正使用到的时候才会加载
         */
        B b = null;

    }

}




class A {

    static {
        System.out.println("A static...");
    }

    public A() {
        System.out.println("A constructor...");
    }

}

class B {

    static {
        System.out.println("B static...");
    }

    public B() {
        System.out.println("B constructor...");
    }

}
